package org.qiyu.live.im.core.server.rpc;

import jakarta.annotation.Resource;
import org.apache.dubbo.config.annotation.DubboService;
import org.qiyu.live.im.core.server.service.IMRouterHandlerService;
import org.qiyu.live.im.dto.ImMsgBody;
import org.qiyu.live.im.core.server.interfaces.IMRouterHandlerRpc;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: sfx
 * Date: 2023-10-12
 * Time: 20:14
 */
@DubboService
public class IMRouterHandlerRpcImpl implements IMRouterHandlerRpc {

    @Resource
    private IMRouterHandlerService imRouterHandlerService;

    @Override
    public void onReceive(ImMsgBody imMsgBody) {
        imRouterHandlerService.onReceive(imMsgBody);
    }

    @Override
    public void batchOnReceive(List<ImMsgBody> imMsgBodyList) {
        imMsgBodyList.forEach(imMsgBody->{
            imRouterHandlerService.onReceive(imMsgBody);
        });
    }
}